// JavaScript Document

function addBookmark( title,url )
{
	if( window.sidebar )
	{
		window.sidebar.addPannel( title, url,'' );
	} else if ( document.all )
	{
		window.external.addFavorite(url, title);
	} else if ( window.opera && window.print ) {
		return true;
	}
}


function init_container_ad( keyword )
{
	var URL = 'data.php';
	$.ajax({
		url:URL,
		dataType: 'json',
		data: {q:keyword},
		success: function(data,status) {
			show_container_ad(data);
		}
	});
}

function show_container_ad(data)
{
	var html = '<dl>';
	for(d in data) {
	   html +=  '<dt style="float:left;"><div id="pic">';
	   html += '<a href="'+data[d].click_url+'" target="_blank">';
	   html += '<img alt="'+data[d].title+'" src="'+data[d].pic_url+'"></a></div>';
	   html += '<div id="txt">';
	   html += '<p id="name"><a href="'+data[d].click_url+'" target="_blank">'+data[d].title+'</a></p>';
	   html += '<p id="price">¥<span>'+data[d].price+'</span>元</p>'; 
	   html += '</div>';
	   html += '</dt>';
	}
	html += '<div style="clear:both;"></div></dl>';
	$('#container-ad').html(html);
}